package com.lagou;

import com.lagou.bean.Resume;
import com.lagou.repository.ResumerRepository;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class MongoRepositoryMain {
    public static void main(String[] args) {
        ApplicationContext  applicationContext = SpringApplication.run(MongoRepositoryMain.class,args);
        ResumerRepository resumeRepository = applicationContext.getBean(ResumerRepository.class);
        System.out.println(resumeRepository.findAll());

        Resume test1 = resumeRepository.findByName("test1");
        System.out.println(test1);

        // 插入resume
        Resume test923842 = resumeRepository.save(Resume.builder().name("test923842").build());
        System.out.println(test923842);
    }
}
